<?php

namespace App\Admin\Controllers;

use App\Models\Blogger;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Controllers\AdminController;

class BloggersController extends AdminController
{
    protected $title = '博主管理';
    
    protected function grid()
    {
        $grid = new Grid(new Blogger());
	
	    $grid->disableExport();
	    
	    $grid->column('blogger_name', '博主名称');
        $grid->column('blogger_url', '博主链接');
        $grid->column('blogger_url_type', '所在平台');
	    $grid->column('blogger_fans_count', '博主粉丝量');
        return $grid;
    }
    
    protected function detail($id)
    {
        $show = new Show(Blogger::findOrFail($id));



        return $show;
    }
    
    protected function form()
    {
        $form = new Form(new Blogger());
	    $form->text('blogger_name', '博主名称');
        $form->text('blogger_url', '博主链接');
	    $form->select('blogger_url_type', '所在平台')->options(config('site.blogger_platform'));
	    $form->number('blogger_fans_count', '粉丝量')->default(0);
	   

        return $form;
    }

}
